/*
 * To change this license header, choose License Headers in Project Properties.
 * To change this template file, choose Tools | Templates
 * and open the template in the editor.
 */

package Model;

import Data.DoanTau;
import java.sql.Connection;
import java.sql.ResultSet;
import java.sql.Statement;
import java.util.ArrayList;

/**
 *
 * @author bienphongvnn
 */
public class DoanTauModel {
    public static ArrayList<DoanTau> ListDoanTau(int loaitau) {	
        ArrayList<DoanTau> ds = new ArrayList<DoanTau>();
        Connection con = ConnectionProvider.Connect();
	try {
            String sql = String.format("SELECT MaTau FROM doantau where LoaiTau = '%d'", loaitau);
            Statement statement	= con.createStatement();
            ResultSet rs = statement.executeQuery(sql);
            while(rs.next()){	
                DoanTau kh = new DoanTau();
                kh.MaTau = rs.getString("MaTau");
                ds.add(kh);	
                } 
            con.close();
        }
        catch(Exception ex){
            System.out.println(ex.getMessage());	
        }
        finally
        {
           
        }
        return	ds;	
    }
}
